from socket import socket
from threading import Timer

server_socket = None
client_connection = None
client_connected = False

def accept_connection():
    global client_connection, server_socket, client_connected
    ss = socket()
    ss.bind(('lcc16',9090))
    ss.listen(1)
    connection, client_address = ss.accept()
    print 'Connected to', client_address
    client_connection = connection
    server_socket = ss
    client_connected = True

print 'Waiting for connections'
Timer(1,accept_connection).start()
print 'Populate game'



while not client_connected:
    for i in range(100000):
        pass

print 'Finishing game'
client_connection.close()
server_socket.close()